package dao.impl;

import java.util.Date;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;

import dao.CommentDao;
import pojo.Comment;
import pojo.Order;
@Repository
public class CommentDaoImpl implements CommentDao {

	@PersistenceContext(name="un")
	private EntityManager manager;
	
	@Override
	public Order replyComment(String comment, String o_id) {
		Order order = (Order)manager.find(Order.class, o_id);
		Comment comment1 = new Comment(comment);
		comment1.setComentDate(new Date());
		boolean status = order.getComment().add(comment1);
		manager.persist(order);
		return order;
	}

}
